<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Measurement Adjectives</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Measurement Adjectives' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">knowledge</a></li><li><a href="index.html#3">Chapter 3: Properties</a></li><li><b>Measurement Adjectives</b></li></ul></div>
<p class="purpose">The family of adjectives arising from property value comparisons.</p>

<ul class="toc"><li><a href="3-ma.html#SP4">&#167;4. Assert</a></li><li><a href="3-ma.html#SP5">&#167;5. Schemas</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>We must define:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">measurement_amf</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">MeasurementAdjectives::start</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">MeasurementAdjectives::start</span></span>:<br/>Knowledge Module - <a href="1-km.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">measurement_amf</span><span class="plain-syntax"> = </span><span class="identifier-syntax">AdjectiveMeanings::new_family</span><span class="plain-syntax">(3);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">measurement_amf</span><span class="plain-syntax">, </span><span class="identifier-syntax">ASSERT_ADJM_MTID</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="3-ma.html#SP4" class="function-link"><span class="function-syntax">MeasurementAdjectives::assert</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">measurement_amf</span><span class="plain-syntax">, </span><span class="identifier-syntax">PREPARE_SCHEMAS_ADJM_MTID</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="3-ma.html#SP5" class="function-link"><span class="function-syntax">MeasurementAdjectives::prepare_schemas</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">measurement_amf</span><span class="plain-syntax">, </span><span class="identifier-syntax">CLAIM_DEFINITION_SENTENCE_ADJM_MTID</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="3-ma.html#SP3" class="function-link"><span class="function-syntax">MeasurementAdjectives::claim_definition</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>Measurement adjectives are created when we parse a "Definition:" clause for
a new adjective, and then only when the definition has a particular form:
</p>

<blockquote>
    <p>Definition: A container is roomy if its carrying capacity is 10 or more.</p>
</blockquote>

<p class="commentary">&lt;measurement-adjective-definition&gt; is used to parse the definition part,
</p>

<blockquote>
    <p>its carrying capacity is 10 or more</p>
</blockquote>

<p class="commentary">The following grammar is a little sketchy because it's parsed very early in
Inform's run; stricter rules eventually apply to all those ellipses.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;measurement-adjective-definition&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;possessive-third-person&gt;</span><span class="plain-syntax"> ... </span><span class="identifier-syntax">is</span><span class="plain-syntax">/</span><span class="identifier-syntax">are</span><span class="plain-syntax"> </span><span class="identifier-syntax">not</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;possessive-third-person&gt;</span><span class="plain-syntax"> {</span><span class="function-syntax">&lt;property-name&gt;</span><span class="plain-syntax">} </span><span class="identifier-syntax">is</span><span class="plain-syntax">/</span><span class="identifier-syntax">are</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;measurement-range&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;possessive-third-person&gt;</span><span class="plain-syntax"> ... </span><span class="identifier-syntax">is</span><span class="plain-syntax">/</span><span class="identifier-syntax">are</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;measurement-range&gt;</span>

<span class="function-syntax">&lt;measurement-range&gt;</span>
<span class="plain-syntax">    ... </span><span class="identifier-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">more</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ... </span><span class="identifier-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">less</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_GradingMisphrased problem</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::definition_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_GradingMisphrased</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Diagrams::new_UNPARSED_NOUN</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"that definition is wrongly phrased"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"assuming it was meant to be a grading adjective like 'Definition: a "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"container is large if its carrying capacity is 10 or more.'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-ma.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>So, then, we look at a Definition and see if we want to claim it as a
measurement.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">MeasurementAdjectives::claim_definition</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">MeasurementAdjectives::claim_definition</span></span>:<br/><a href="3-ma.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">adjective_meaning</span><span class="plain-syntax"> **</span><span class="identifier-syntax">result</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">q</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">sense</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">AW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">DNW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CALLW</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sense</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;measurement-adjective-definition&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">CONW</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">shape</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">PRW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;measurement-adjective-definition&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">THRESW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;measurement-range&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-ma.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Reject some overly elaborate attempts to define overly elaborate measurements</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-ma.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">Allow an exact measurement to be created only if we can already parse the threshold</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">measurement_definition</span><span class="plain-syntax"> *</span><span class="identifier-syntax">mdef</span><span class="plain-syntax"> = </span><a href="3-msr.html#SP5" class="function-link"><span class="function-syntax">Measurements::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="identifier-syntax">AW</span><span class="plain-syntax">, </span><span class="identifier-syntax">THRESW</span><span class="plain-syntax">, </span><span class="identifier-syntax">prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">shape</span><span class="plain-syntax">, </span><span class="identifier-syntax">PRW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">shape</span><span class="plain-syntax"> != </span><span class="constant-syntax">MEASURE_T_EXACTLY</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-ma.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">Create the superlative form</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-ma.html#SP3_4" class="named-paragraph-link"><span class="named-paragraph">Create the adjectival meaning arising from this measurement</span><span class="named-paragraph-number">3.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">headword_as_adjective</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Reject some overly elaborate attempts to define overly elaborate measurements</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">AW</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">shape</span><span class="plain-syntax"> != </span><span class="constant-syntax">MEASURE_T_EXACTLY</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::definition_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_MultiwordGrading</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="string-syntax">"a grading adjective must be a single word"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"as in 'Definition: a container is large if its carrying capacity is "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"10 or more.': 'fairly large' would not be allowed because it would "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"make no sense to talk about 'fairly larger' or 'fairly largest'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">CALLW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">shape</span><span class="plain-syntax"> != </span><span class="constant-syntax">MEASURE_T_EXACTLY</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::definition_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_GradingCalled</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="string-syntax">"callings are not allowed when defining grading adjectives"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"so 'Definition: a container is large if its carrying capacity is 10 "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"or more.' is fine, but so 'Definition: a container (called the bag) "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"is large if its carrying capacity is 10 or more.' is not - then again, "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"there's very little call for it."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sense</span><span class="plain-syntax"> != </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">shape</span><span class="plain-syntax"> != </span><span class="constant-syntax">MEASURE_T_EXACTLY</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::definition_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_GradingUnless</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="string-syntax">"'unless' is not allowed when defining grading adjectives"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"so 'Definition: a container is large if its carrying capacity is 10 "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"or more.' is fine, but so 'Definition: a container is modest unless "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"its carrying capacity is 10 or more.' is not - of course a similar "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"effect could be achieved by 'Definition: a container is modest if its "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"carrying capacity is 9 or less.'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-ma.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b>Perhaps this is a good point to say why we allow any exact measurements at
all. After all, if we didn't, a definition like:
</p>

<blockquote>
    <p>Definition: a person is handy if his carrying capacity is 7.</p>
</blockquote>

<p class="commentary">...would still work; and "handy" would then be created as a <span class="extract"><span class="extract-syntax">condition_amf</span></span>
adjective. So why not let that happen?
</p>

<p class="commentary">The answer is that our <span class="extract"><span class="extract-syntax">measurement_amf</span></span> adjectives behave exactly the same
at run-time, but can also be asserted true in the model world at compile-time.
In particular, we could write:
</p>

<blockquote>
    <p>Peter is a handy person.</p>
</blockquote>

<p class="commentary">This can't be done with general <span class="extract"><span class="extract-syntax">condition_amf</span></span> adjectives, because conditions
can't normally be unravelled at compile time.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Allow an exact measurement to be created only if we can already parse the threshold</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">shape</span><span class="plain-syntax"> == </span><span class="constant-syntax">MEASURE_T_EXACTLY</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;s-literal&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">THRESW</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-ma.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3" class="paragraph-anchor"></a><b>&#167;3.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Create the superlative form</span><span class="named-paragraph-number">3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">superlative</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Grading::make_superlative</span><span class="plain-syntax">(</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">headword</span><span class="plain-syntax">, </span><span class="identifier-syntax">Task::language_of_syntax</span><span class="plain-syntax">());</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-ma.html#SP3_3_1" class="named-paragraph-link"><span class="named-paragraph">Feed the preamble for the superlative phrase into the lexer</span><span class="named-paragraph-number">3.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-ma.html#SP3_3_2" class="named-paragraph-link"><span class="named-paragraph">Feed the body of the superlative phrase into the lexer</span><span class="named-paragraph-number">3.3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ImperativeSubtrees::accept_all</span><span class="plain-syntax">();</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-ma.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3_1" class="paragraph-anchor"></a><b>&#167;3.3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Feed the preamble for the superlative phrase into the lexer</span><span class="named-paragraph-number">3.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">, </span><span class="string-syntax">" To decide which object is %N ( S - description of objects ) "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">superlative</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Sentences::make_node</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Feeds::feed_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="character-syntax">':'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-ma.html#SP3_3">&#167;3.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3_2" class="paragraph-anchor"></a><b>&#167;3.3.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Feed the body of the superlative phrase into the lexer</span><span class="named-paragraph-number">3.3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">, </span><span class="string-syntax">" (- {-primitive-definition:extremal%s%W}  -) "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="3-msr.html#SP3" class="function-link"><span class="function-syntax">Measurements::strict_comparison</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">region_shape</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">name_of_property_to_compare</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Sentences::make_node</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">Feeds::feed_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">), </span><span class="character-syntax">'.'</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">TEMP</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-ma.html#SP3_3">&#167;3.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_4" class="paragraph-anchor"></a><b>&#167;3.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Create the adjectival meaning arising from this measurement</span><span class="named-paragraph-number">3.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax"> = </span><span class="identifier-syntax">AdjectiveMeanings::new</span><span class="plain-syntax">(</span><span class="identifier-syntax">measurement_amf</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">STORE_POINTER_measurement_definition</span><span class="plain-syntax">(</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">), </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">q</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">headword_as_adjective</span><span class="plain-syntax"> = </span><span class="identifier-syntax">am</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">adjective</span><span class="plain-syntax"> *</span><span class="identifier-syntax">adj</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Adjectives::declare</span><span class="plain-syntax">(</span><span class="identifier-syntax">AW</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">AdjectiveAmbiguity::add_meaning_to_adjective</span><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">adj</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">AdjectiveMeanings::perform_task_via_function</span><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">AdjectiveMeaningDomains::set_from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="identifier-syntax">DNW</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-ma.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Assert.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">MeasurementAdjectives::assert</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">MeasurementAdjectives::assert</span></span>:<br/><a href="3-ma.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">infs_to_assert_on</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">parity</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">measurement_definition</span><span class="plain-syntax"> *</span><span class="identifier-syntax">mdef</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RETRIEVE_POINTER_measurement_definition</span><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">family_specific_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-msr.html#SP9" class="function-link"><span class="function-syntax">Measurements::validate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="3-msr.html#SP10" class="function-link"><span class="function-syntax">Measurements::is_valid</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">prop</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">parity</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;s-literal&gt;(mdef-&gt;</span><span class="element-syntax">region_threshold_text</span><span class="plain-syntax">)) </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"literal unreadable"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="5-pi.html#SP4" class="function-link"><span class="function-syntax">PropertyInferences::draw</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">infs_to_assert_on</span><span class="plain-syntax">, </span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">prop</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. Schemas.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">MeasurementAdjectives::prepare_schemas</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">MeasurementAdjectives::prepare_schemas</span></span>:<br/><a href="3-ma.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">adjective_meaning_family</span><span class="plain-syntax"> *</span><span class="identifier-syntax">family</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">adjective_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">am</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">measurement_definition</span><span class="plain-syntax"> *</span><span class="identifier-syntax">mdef</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RETRIEVE_POINTER_measurement_definition</span><span class="plain-syntax">(</span><span class="identifier-syntax">am</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">family_specific_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">prop</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">region_threshold_evaluated</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTAdjectives::make_mdef_test_schema</span><span class="plain-syntax">(</span><span class="identifier-syntax">mdef</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="3-msr.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-km.html">1</a></li><li class="progresschapter"><a href="2-ins.html">2</a></li><li class="progresscurrentchapter">3</li><li class="progresssection"><a href="3-prp.html">prp</a></li><li class="progresssection"><a href="3-ep.html">ep</a></li><li class="progresssection"><a href="3-epa.html">epa</a></li><li class="progresssection"><a href="3-vp.html">vp</a></li><li class="progresssection"><a href="3-tpr.html">tpr</a></li><li class="progresssection"><a href="3-spr.html">spr</a></li><li class="progresssection"><a href="3-spr2.html">spr2</a></li><li class="progresssection"><a href="3-msr.html">msr</a></li><li class="progresscurrent">ma</li><li class="progresssection"><a href="3-cr.html">cr</a></li><li class="progresschapter"><a href="4-is.html">4</a></li><li class="progresschapter"><a href="5-inf.html">5</a></li><li class="progressnext"><a href="3-cr.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

